/**
 * Created by Administrator on 2018/1/18.
 */
layui.use(['jquery','form','layer'], function(){
    var $ = layui.jquery,
        layer = layui.layer,
        form = layui.form;

    //监听表单提交
    form.on('submit(change)', function(data){
        post_data = data.field;
        $.ajax({
            type: "POST",
            url: '/user/change',
            data: post_data,
            dataType: "json",
            success: function(data){
                if(data.code==200){
                    //关闭当前iframe页面
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);

                    //父页面弹出layer
                    parent.layer.msg(data.msg);

                }else{
                    parent.layer.msg(data.msg);
                }
            }
        });
        return false;
    });

});
